export class BalanceManager {
    constructor() {
        this.isBalanceLoading = !1
    }
    async fetchBalance(a) {
        try {
            const e = await fetch("https://api.deepseek.com/user/balance", {
                method: "GET",
                headers: {
                    Accept: "application/json",
                    Authorization: `Bearer ${a}`
                }
            });
            if (!e.ok) throw new Error("Failed to fetch balance");
            return await e.json()
        } catch (a) {
            throw console.error("Error fetching balance:", a), a
        }
    }
    formatBalance(a, e) {
        const t = parseFloat(a);
        return new Intl.NumberFormat("zh-CN", {
            style: "currency",
            currency: e || "CNY",
            minimumFractionDigits: 2
        }).format(t)
    }
    isLoading() {
        return this.isBalanceLoading
    }
    setLoading(a) {
        this.isBalanceLoading = a
    }
}